﻿package view.popup
{
    import com.core.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import flash.events.*;
    import flash.filters.*;
    import flash.text.*;
    import morn.core.components.*;

    public class JingBaoDialog extends View implements IDialogUI
    {
        public var canelBtn:Button;
        public var sureBtn:Button;
        public var checkBox:CheckBox;
        public var closeBtn:Button;
        protected var uiXML:XML;
        private var title:TextField;
        private var isSelected:Boolean = false;

        public function JingBaoDialog()
        {
            this.uiXML = <View>r
n	t	t	t  <FlashS9Bg skin=""png.common.ms9"" x=""0"" y=""14"" width=""352"" height=""206""/>r
n	t	t	t  <Image url=""png.common.title"" x=""60"" y=""0""/>r
n	t	t	t  <Button label=""我不需要"" skin=""png.common.btn_usual_normal"" x=""53"" y=""159"" labelColors=""0xb29a6c, 0xb29a6c, 0xb29a6c"" var=""canelBtn"" labelStroke=""1"" labelFont=""宋体""/>r
n	t	t	t  <Label text=""您是否觉得画面很卡呢，屏蔽其他玩家和特效可以使您的画面变得更加流畅，是否需要帮您屏蔽？"" x=""42"" y=""51"" color=""0xb29a6c"" multiline=""true"" wordWrap=""true"" width=""277"" height=""70"" size=""14"" leading=""3"" stroke=""1"" font=""宋体""/>r
n	t	t	t  <Button label=""确认屏蔽"" skin=""png.common.btn_usual_normal"" x=""208"" y=""159"" labelColors=""0xb29a6c, 0xb29a6c, 0xb29a6c"" var=""sureBtn"" labelStroke=""1"" labelFont=""宋体""/>r
n	t	t	t  <CheckBox label=""本次登陆不再提示"" skin=""png.common.checkbox"" x=""100"" y=""127"" labelColors=""0xb29a6c, 0xb29a6c, 0xb29a6c"" labelStroke=""1"" labelFont=""宋体"" var=""checkBox""/>r
n	t	t	t  <Button skin=""png.common.btn_close_normal"" x=""324"" y=""16"" var=""closeBtn""/>r
n	t	t	t</View>")("<View>
			  <FlashS9Bg skin="png.common.ms9" x="0" y="14" width="352" height="206"/>
			  <Image url="png.common.title" x="60" y="0"/>
			  <Button label="我不需要\" skin="png.common.btn_usual_normal" x="53" y="159" labelColors="0xb29a6c, 0xb29a6c, 0xb29a6c" var="canelBtn" labelStroke="1" labelFont="宋体"/>
			  <Label text="您是否觉得画面很卡呢，屏蔽其他玩家和特效可以使您的画面变得更加流畅，是否需要帮您屏蔽？" x="42" y="51" color="0xb29a6c" multiline="true" wordWrap="true" width="277" height="70" size="14" leading="3" stroke="1" font="宋体"/>
			  <Button label="确认屏蔽" skin="png.common.btn_usual_normal" x="208" y="159" labelColors="0xb29a6c, 0xb29a6c, 0xb29a6c" var="sureBtn" labelStroke="1" labelFont="宋体"/>
			  <CheckBox label="本次登陆不再提示" skin="png.common.checkbox" x="100" y="127" labelColors="0xb29a6c, 0xb29a6c, 0xb29a6c" labelStroke="1" labelFont="宋体" var="checkBox"/>
			  <Button skin="png.common.btn_close_normal" x="324" y="16" var="closeBtn"/>
			</View>;
            return;
        }// end function

        override protected function createChildren() : void
        {
            createView(this.uiXML);
            this.init();
            return;
        }// end function

        override protected function initialize() : void
        {
            super.initialize();
            return;
        }// end function

        public function init() : void
        {
            this.visible = false;
            this.x = GlobalLayer.instance.root.stage.stageWidth - this.width - 50;
            this.y = GlobalLayer.instance.root.stage.stageHeight - this.height - 100;
            this.title = new TextField();
            this.title.x = 92;
            this.title.y = 7;
            this.title.width = 166;
            this.title.height = 25;
            this.title.defaultTextFormat = new TextFormat("宋体", 15, MColor.New16);
            this.title.autoSize = TextFieldAutoSize.CENTER;
            this.title.filters = [new GlowFilter(MColor.New12, 1, 2, 2, 2, BitmapFilterQuality.HIGH)];
            this.title.selectable = false;
            this.title.text = "前端报警";
            this.addChild(this.title);
            this.sureBtn.addEventListener(MouseEvent.CLICK, this.onPingBi);
            this.canelBtn.addEventListener(MouseEvent.CLICK, this.onClose);
            this.checkBox.selected = false;
            this.checkBox.addEventListener(MouseEvent.CLICK, this.onCheckBox);
            this.closeBtn.addEventListener(MouseEvent.CLICK, this.onClose);
            this.addEventListener(MouseEvent.MOUSE_DOWN, this.onDown);
            GlobalLayer.instance.root.addEventListener(Event.RESIZE, this.resizeHandler);
            return;
        }// end function

        public function show(param1:Object) : void
        {
            if (this.isSelected == true)
            {
                this.visible = false;
            }
            else
            {
                this.visible = true;
            }
            return;
        }// end function

        private function onPingBi(event:MouseEvent) : void
        {
            ModelProxy.change("minimap", "hideSome", null);
            ModelProxy.change("data", "noclientwarning", true);
            this.close();
            return;
        }// end function

        private function onCheckBox(event:MouseEvent) : void
        {
            this.isSelected = this.checkBox.selected;
            ModelProxy.change("data", "noclientwarning", true);
            return;
        }// end function

        private function onClose(event:MouseEvent) : void
        {
            this.close();
            return;
        }// end function

        public function close() : void
        {
            this.visible = false;
            return;
        }// end function

        private function onDown(event:MouseEvent) : void
        {
            event.stopImmediatePropagation();
            return;
        }// end function

        private function resizeHandler(event:Event) : void
        {
            this.x = GlobalLayer.instance.root.stage.stageWidth - this.width - 50;
            this.y = GlobalLayer.instance.root.stage.stageHeight - this.height - 100;
            return;
        }// end function

    }
}
